package com.travel.admin.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Desc:
 * @Author: hong ming
 * @Date: 2023/10/07
 */
@Configuration
public class ThreadPoolConfig {

    @Bean
    public ThreadPoolExecutor fiveThreadPool() {
        return new ThreadPoolExecutor(5, 5, 60, TimeUnit.MINUTES, new LinkedBlockingQueue<>(30000));
    }

    @Bean
    public ThreadPoolExecutor singleThreadPool() {
        return new ThreadPoolExecutor(1, 1, 60, TimeUnit.MINUTES, new LinkedBlockingQueue<>(30000));
    }

    @Bean
    public ThreadPoolExecutor sixteenThreadPool() {
        return new ThreadPoolExecutor(16, 16, 60, TimeUnit.MINUTES, new LinkedBlockingQueue<>(30000));
    }
}
